import { computed } from 'vue'
import { 
  enUS, 
  zhCN, 
  zhTW, 
  idID, 
  itIT, 
  ukUA,
  koKR,
  ptBR,
  thTH,
  jaJP,
  frFR,
  viVN,
  ruRU,
  trTR,
} from 'naive-ui'
import hiIN from '@/locales/naive/hi-IN'
import { useAppStore } from '@/store'
import { setLocale } from '@/locales'

export function useLanguage() {
  const appStore = useAppStore()

  const langMap: any = {
    'en-us': enUS,
    'zh-cn': zhCN,
    'zh-tw': zhTW,
    'hi-in': hiIN,
    'it-it': itIT,
    'uk-ua': ukUA,
    'ko-kr': koKR,
    'pt-pt': ptBR,
    'fil-ph': enUS,
    'th-th': thTH,
    'ja-jp': jaJP,
    'id-id': idID,
    'fr-fr': frFR,
    'vi-vn': viVN,
    'ru-ru': ruRU,
    'tr-tr': trTR,
  }

  const language = computed(() => {
    setLocale(appStore.language)
    return langMap[appStore.language] || enUS;
  })

  return { language }
}
